package com.spicy_clock;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageButton;
//import android.view.InputEvent;
import android.widget.ImageView;

public class MainActivity extends Activity {
    
   private OnTouchListener l_listener;
   private OnTouchListener m_listener;
   private OnTouchListener r_listener;
   private OnTouchListener exit_listner;
    
 
   private ImageButton left_btn;
   private ImageButton mid_btn;
   private ImageButton right_btn;
   private ImageButton exit_btn;
   private ImageView bottombar;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       // get().setAlfa(0);
        l_listener = new OnTouchListener() {
        	public boolean onTouch(View v,MotionEvent event){
        		if(event.getAction() == MotionEvent.ACTION_DOWN)
        		{
        		    left_btn.setBackgroundDrawable(getResources().getDrawable(R.drawable.mainmenuselected));
        		}
        		else if(event.getAction() == MotionEvent.ACTION_UP)
        		{
        		    left_btn.setBackgroundDrawable(getResources().getDrawable(R.drawable.mainmenu));
        		    Intent left_intentIntent = new Intent(MainActivity.this, ArchiveActivity.class);
            		    startActivity(left_intentIntent);
        		}
        		
        		
        		return false;
        	}
        	
        	
        	
        };
       m_listener = new OnTouchListener() {
        	public boolean onTouch(View v,MotionEvent event){
        		if(event.getAction()== MotionEvent.ACTION_DOWN)
        		{
        		    mid_btn.setBackgroundDrawable(getResources().getDrawable(R.drawable.videocall_selected));
        		}
        		else if(event.getAction() == MotionEvent.ACTION_UP)
        		{
        		    mid_btn.setBackgroundDrawable(getResources().getDrawable(R.drawable.videocall));
        		}
        		return false;
        	}
        	
        };
        r_listener = new OnTouchListener()
	{
	    
	    public boolean onTouch(View v, MotionEvent event)
		{
		   if(event.getAction() == MotionEvent.ACTION_DOWN)
		   {
		       right_btn.setBackgroundDrawable(getResources().getDrawable(R.drawable.timesettingselected));
		   }
		   else if(event.getAction() == MotionEvent.ACTION_UP)
		   {
		       right_btn.setBackgroundDrawable(getResources().getDrawable(R.drawable.timesetting));
		   }
		   
		    return false;
		}
	};
	exit_listner = new OnTouchListener()
	{
	    
	    public boolean onTouch(View v, MotionEvent event)
		{
		   if(event.getAction() == MotionEvent.ACTION_DOWN)
		   {
		       exit_btn.setBackgroundDrawable(getResources().getDrawable(R.drawable.exitbtnselected));
		   }
		   else if(event.getAction()== MotionEvent.ACTION_UP)
		   {
		       exit_btn.setBackgroundDrawable(getResources().getDrawable(R.drawable.exitbtnimage));
		   }
		    return false;
		}
	};
        left_btn = (ImageButton)findViewById(R.id.mainmenubtn);
        right_btn = (ImageButton)findViewById(R.id.timesettingbtn);
        mid_btn = (ImageButton)findViewById(R.id.videocallbtn);
        exit_btn = (ImageButton)findViewById(R.id.exitbtn);
        bottombar =(ImageView)findViewById(R.id.bottombar);
        
        
        left_btn.setOnTouchListener(l_listener);
        right_btn.setOnTouchListener(r_listener);
        mid_btn.setOnTouchListener(m_listener);
        exit_btn.setOnTouchListener(exit_listner);
    }

   
}
